package com.wyl.tinyservice.bizdemo.controller;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWorldController {
	
	@Value(value="${server.servlet.context-path}")
	private String contextPath;
	
	@Value(value="${server.port}")
	private Integer port;

	@RequestMapping("/")
	public Object hello() {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("content", "Hello World ! ");
		result.put("curent-time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(Calendar.getInstance().getTime()));
		result.put("context-path", contextPath);
		result.put("port", port);
		return result;
	}

}
